package Slides
{
	import flash.events.MouseEvent;
	
	import mx.containers.Canvas;
	
	public class ImageCnvs extends Canvas
	{
		private var childCanvas : Canvas;
		private var ParentCanvas :Canvas;
		private var MyParentCnvs : Canvas;
		private var MychildNo : Object;
		
		public function ImageCnvs()
		{
			
			this.setStyle("borderStyle","solid");
			
			this.addEventListener(MouseEvent.MOUSE_DOWN,strtDrag);
			this.addEventListener(MouseEvent.MOUSE_UP,stpDrag);
			this.addEventListener(MouseEvent.CLICK,setChildNo);
		}
		
		private function strtDrag(event : MouseEvent):void{
			if(this.contentMouseY<5)
			event.currentTarget.startDrag();
			
		}
		
		private function stpDrag(event:MouseEvent):void{
			event.currentTarget.stopDrag();
			trace(event.currentTarget.x);
			trace(event.currentTarget.y);
			this.x=event.currentTarget.x;
			this.y=event.currentTarget.y;
			//this.childCanvas.x=event.currentTarget.x*this.ParentCanvas.width/this.MyParentCnvs.width;
			//this.childCanvas.y=event.currentTarget.y*this.ParentCanvas.height/this.MyParentCnvs.height;
		}
		
		private function setChildNo(event : MouseEvent):void{
			this.MychildNo.int=this.MyParentCnvs.getChildIndex(this);
			trace("got this" + this.MychildNo.int);
		}
		public function setRefrence(MyparentCnvs:Canvas,selChildIndex:Object):void{
			/*this.childCanvas=new Canvas;
			this.ParentCanvas=new Canvas;*/
			this.MyParentCnvs=new Canvas;
			this.MychildNo=new Object ;
			
			/*this.childCanvas=childCnvs;
			this.ParentCanvas=parentCnvs;*/
			this.MyParentCnvs=MyparentCnvs;
			this.MychildNo=selChildIndex ;
			
			this.MychildNo.int=this.MyParentCnvs.getChildIndex(this);
		}
		
	
	}
}